import Vuex from 'vuex';
import Vue from 'vue';
// import { baseUrl } from '../config/env';
import state from './state';
import getters from './getters';
import actions from './actions';
import mutations from './mutations';
import createPersistedState from 'vuex-persistedstate';
Vue.use(Vuex);

/* if (process.env.NODE_ENV == 'production') {//生产环境
  imgPrefix = '/storage/';
} else { //开发环境 dev

  imgPrefix = baseUrl + '/storage/';
} */

export default new Vuex.Store({
  state,
  mutations,
  getters,
  actions,
  plugins: [
    createPersistedState({
      storage: window.sessionStorage,
      reducer(val) {
        return {
          sysConfig: val.sysConfig,
          token: val.token,
        };
      }
    })
  ]
});